package com.neusoft.neu24.service.impl;

import com.neusoft.neu24.Result.CommonResult;
import com.neusoft.neu24.Result.ResultCode;
import com.neusoft.neu24.dto.Aqi2Screen;
import com.neusoft.neu24.entity.Province;
import com.neusoft.neu24.mapper.TbEntityMapper;
import com.neusoft.neu24.service.ITbService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import org.springframework.stereotype.Service;




@Service
public class TbServiceImpl implements ITbService {
    @Autowired
    private TbEntityMapper tbEntityMapper;

    @Override
    public CommonResult<List<Province>> queryf(){
        List<Province> result = tbEntityMapper.queryf();
        if (result.isEmpty()) return CommonResult.failed(ResultCode.NULL);
        return CommonResult.success(result);
    }

    @Override
    public CommonResult<Aqi2Screen> queryAqi() {
        Aqi2Screen aqi = tbEntityMapper.queryAqi();
        if (aqi == null) return CommonResult.failed(ResultCode.DATA_ERROR);
        return CommonResult.success(aqi);
    }
}
